package com.hmjk.health.views;

import com.hmjk.health.R;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

public  class  CustomDialog extends AlertDialog{
	private View mLayout = null;
	private Context mContext = null;
	
	public  CustomDialog(Context context,int theme, View layout) {
	    super(context, theme);
	    mLayout = layout;
	    mContext = context;
	}

	public  CustomDialog(Context context) {
	    super(context);
	    mContext = context;
	}

	@Override
	protected   void  onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    if(mLayout == null){
	    	LayoutInflater inflater = LayoutInflater.from(mContext);

	    	mLayout = inflater.inflate(R.layout.blank, null);
	    }
	    setContentView(mLayout);
	    
	    Window dialogWindow = getWindow();
        WindowManager.LayoutParams lp = dialogWindow.getAttributes();            
        lp.x = 0;
        lp.y = 0;
        lp.width = mContext.getResources().getDisplayMetrics().widthPixels; 
        lp.height = mContext.getResources().getDisplayMetrics().heightPixels;
        //lp.alpha = 1f;
        dialogWindow.setAttributes(lp);  
	}
}
